IOMMU/x86: maintain a per-device pseudo domain ID
authorJan Beulich <jbeulich@suse.com>
Tue, 5 Apr 2022 12:48:29 +0000 (14:48 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 5 Apr 2022 12:48:29 +0000 (14:48 +0200)
commit3e65372436fb6bbfdc59e4175d4a41b398000e0a
treeaaf1d24a6e2c6cbff57608804fc9b20e256e6a66
parent26293b93409bb46bcc8445379ff9f1841f7f98d2
IOMMU/x86: maintain a per-device pseudo domain ID

In order to subsequently enable per-device quarantine page tables, we'll
need domain-ID-like identifiers to be inserted in the respective device
(AMD) or context (Intel) table entries alongside the per-device page
table root addresses.

Make use of "real" domain IDs occupying only half of the value range
coverable by domid_t.

Note that in VT-d's iommu_alloc() I didn't want to introduce new memory
leaks in case of error, but existing ones don't get plugged - that'll be
the subject of a later change.

The VT-d changes are slightly asymmetric, but this way we can avoid
assigning pseudo domain IDs to devices which would never be mapped while
still avoiding to add a new parameter to domain_context_unmap().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
master commit: 97af062b89d52c0ecf7af254b53345c97d438e33
master date: 2022-04-05 14:19:10 +0200
xen/drivers/passthrough/amd/iommu.h
xen/drivers/passthrough/amd/iommu_detect.c
xen/drivers/passthrough/amd/pci_amd_iommu.c
xen/drivers/passthrough/pci.c
xen/drivers/passthrough/vtd/iommu.c
xen/drivers/passthrough/vtd/iommu.h
xen/drivers/passthrough/x86/iommu.c
xen/include/asm-x86/iommu.h
xen/include/asm-x86/pci.h